//
//  RHHomeCycleCell.m
//  RuiHeAppApp
//
//  Created by Jun on 2023/7/18.
//

#import "RHHomeCycleCell.h"

@interface RHHomeCycleCell()<SDCycleScrollViewDelegate>

@property (nonatomic ,strong) SDCycleScrollView * cycleScrollView;   // 轮播图 View

@end

@implementation RHHomeCycleCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        [self setupUI];
    }
    return self;
}


- (void)setupUI{
    
    [self setBackgroundColor:UIColor.clearColor];
    [self.contentView setBackgroundColor:UIColor.clearColor];
    
    //    //轮播图
    _cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame: CGRectMake(0, 0, kUI_WINDOW_W, kBannerHeightValue) delegate: self placeholderImage: kImage(@"Home_guangao-1")];//BannerDef22
    _cycleScrollView.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter;
    _cycleScrollView.autoScrollTimeInterval = 5;
    _cycleScrollView.pageControlStyle = SDCycleScrollViewPageContolStyleClassic;
    _cycleScrollView.showPageControl = YES;
    _cycleScrollView.delegate = self;
    _cycleScrollView.userInteractionEnabled = YES;
    _cycleScrollView.backgroundColor = [UIColor whiteColor];
    [_cycleScrollView.layer setCornerRadius:8];
    [_cycleScrollView.layer setMasksToBounds:YES];
    _cycleScrollView.delegate = self;
    _cycleScrollView.pageControlDotSize = CGSizeMake(8, 8);
    _cycleScrollView.currentPageDotImage = kImage(@"icon_banneryuan14");
    _cycleScrollView.pageDotImage = kImage(@"icon_bannerfang14");
    [self.contentView addSubview: _cycleScrollView];
    
    [_cycleScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.mas_offset(0);
        make.left.mas_offset(15);
        make.right.mas_offset(-15);
        make.height.mas_equalTo(200);
    }];
    
    [self setCycleScrollViewImageURLStrGroup];
    
}

//MARK: NOTE --设置滚动视图Banner图---
-(void)setCycleScrollViewImageURLStrGroup{
   
     NSArray *imgArr = @[@"home_circle01",@"home_circle02",@"home_circle03"];
     //self.cycleScrollView.imageURLStringsGroup = _imageMuArr;
     self.cycleScrollView.imageURLStringsGroup = imgArr;
     self.cycleScrollView.placeholderImage = kImage(@"Home_guangao-1");

}

- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index
{
    if(self.selectBlock){
        self.selectBlock(index);
    }
}





@end
